package com.whfc.ms.api.safety.service.impl;

import com.whfc.common.result.PageData;
import com.whfc.ms.api.safety.service.MsSafetyFineService;
import com.whfc.safety.dto.SafetyFineDTO;
import com.whfc.safety.dto.SafetyFineNumDTO;
import com.whfc.safety.param.SafetyFineAddParam;
import com.whfc.safety.param.SafetyFineCompleteParam;
import com.whfc.safety.service.SafetyFineService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class MsSafetyFineServiceImpl implements MsSafetyFineService {

    @DubboReference(interfaceClass = SafetyFineService.class, version = "1.0.0")
    private SafetyFineService qualityFineService;

    @Override
    public PageData<SafetyFineDTO> list(Integer deptId, String corpName, String userName, String state, Date startTime, Date endTime, Integer pageNum, Integer pageSize) {
        return qualityFineService.list(deptId, corpName, userName, state, startTime, endTime, pageSize, pageNum);
    }

    @Override
    public SafetyFineNumDTO num(Integer deptId, String corpName, String userName, Date startTime, Date endTime) {
        return qualityFineService.num(deptId, corpName, userName, startTime, endTime);
    }

    @Override
    public void add(SafetyFineAddParam param) {
        qualityFineService.add(param);
    }

    @Override
    public void del(Integer fineId) {
        qualityFineService.del(fineId);
    }

    @Override
    public void complete(SafetyFineCompleteParam param) {
        qualityFineService.complete(param);
    }

    @Override
    public void export(String fineIds, Integer deptId) {
        String[] strIds = fineIds.split(",");
        List<Integer> intIds = Arrays.stream(strIds).map(Integer::valueOf).collect(Collectors.toList());
        qualityFineService.fineExport(intIds, deptId);
    }

    @Override
    public void deleteBatch(List<Integer> idList) {
        qualityFineService.deleteBatch(idList);
    }
}
